﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue对象常用的方法</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <div ref="title">{{message}}</div>
    </div>
    <script>
        var vm = new Vue({
            el: "#app",
            data: {
                message: "hello world"
            }
        });

        // vm.$destroy();  //销毁

        // var vm=new Vue({
        //     data:{

        //     }
        // }).$mount("#app"); // 外部绑定

        vm.message = "tom"; //更改 message 的 值

        console.log(vm.$refs.title.textContent);//hello world

        vm.$nextTick(function () { //更新过程需要时间

            console.log("$nextTick:"+vm.$refs.title.textContent);// tom
        });


        setTimeout(function () {

            console.log("setTimeout:"+vm.$refs.title.textContent);//hello world

        }, 2000);


    </script>
</body>

</html>